package com.itfitness.cppdemoone.activity

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.itfitness.cppdemoone.R
import com.itfitness.cppdemoone.databinding.ActivityBoundaryfillBinding
import com.itfitness.cppdemoone.databinding.ActivityHistogramaveragBinding

/**
 *
 * @Description:     java类作用描述 直方图均值化
 * @Author:         作者名
 * @CreateDate:     2022/2/23 17:01
 * @UpdateUser:     更新者：
 * @UpdateDate:     2022/2/23 17:01
 * @UpdateRemark:   更新说明：
 */
class HistogramAverageActivity:AppCompatActivity(){
    private lateinit var histogramaveragBinding: ActivityHistogramaveragBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        histogramaveragBinding = DataBindingUtil.setContentView(this, R.layout.activity_histogramaverag)
        val bitmapSrc = BitmapFactory.decodeResource(resources,R.drawable.img_2)
        histogramaveragBinding.activityHistogramaveragImgDestOne.setImageBitmap(imageHistogramAverage(bitmapSrc))
        val bitmapSrcTwo = BitmapFactory.decodeResource(resources,R.drawable.img_2)
        histogramaveragBinding.activityHistogramaveragImgDestTwo.setImageBitmap(imageAdaptiveHistogramAverage(bitmapSrcTwo))
    }


    /**
     * 均值化
     */
    external fun imageHistogramAverage(bitmapSrc:Bitmap):Bitmap

    /**
     * 自适应均值化
     */
    external fun imageAdaptiveHistogramAverage(bitmapSrc:Bitmap):Bitmap
}